//封装组织结构的接口
import instance from "@/utils/request";

//封装获取组织结构数据
export function getDepartmentApi() {
    return instance({
        url: '/company/department'
    })
}

//删除
//根据id删除部门
export function delDepartmentApi(id) {
    return instance({
        url: `/company/department/${id}`,
        method: 'DELETE'
    })
}

//新增
//根据id新增部门
export function addDepartmentApi(data) {
    return instance({
        url: '/company/department',
        method: 'post',
        data
    })
}

//编辑
//根据id获得部门信息
export function getDepartmentIdApi(id) {
    return instance({
        url: `/company/department/${id}`,
    })
}

// 根据 id 修改部门信息
export function editDepartmentByIdApi (data) {
    return instance({
      url: `/company/department/${data.id}`,
      method: 'PUT',
      data
    })
  }
  